<template>
    <div class="app-container">
        <levelbar></levelbar>
        <el-form label-width="90px" class="app-content" :rules="rules" :model="ruleForm" ref="ruleForm">
            <div class="box">
                <div class="appTitle"><h3>查看家长信息</h3></div>
                 <div class="form-item-title">
                        <span class="title-level">家长身份</span>
                 </div>
                <p v-if="!dataForm.length" class="warn-infor">暂无家长学生关联信息</p>
                <el-row :gutter="20" v-for="(site,index) in dataForm" :key="index" class="mLeft">
                    <el-col :span="6">
                        <el-form-item label="关联学生：">
                             <span>{{site.studentName}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="e学云ID号：">
                            <span>{{site.exueCode}}</span>
                        </el-form-item>
                    </el-col>
                     <el-col :span="6" >
                        <el-form-item label="关系：">
                             <span>{{site.relation}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item  prop="checkMange"  v-model="site.checkMange">
                            <el-button type="primary" @click="checkParentManage(site.studentId)">查看</el-button>
                        </el-form-item>
                    </el-col>
                </el-row>
            
                <!-- <div class="appTop"><P>注册信息</p></div> -->
                <div class="form-item-title">
                        <span class="title-level">注册信息</span>
                 </div>
                <el-row  :gutter="20" class="mLeft">                   
                    <el-col :span="12">
                        <el-form-item label="姓名：">
                             <span>{{ruleForm.realName}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12" >
                        <el-form-item label="手机号：">
                               <span>{{ruleForm.phone}}</span>
                        </el-form-item>
                    </el-col>
                   
                </el-row>
                <el-row  :gutter="20" class="mLeft">                   
                    <el-col :span="12">
                        <el-form-item label="e学云ID号：">
                              <span>{{ruleForm.studentId}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12" >
                        <el-form-item label="注册情况：">
                               <span>{{ruleForm.enrollSituation}}</span>
                        </el-form-item>
                    </el-col>
                </el-row>
                <!-- <div class="appTop"><P>基础信息</p></div> -->
                 <div class="form-item-title">
                        <span class="title-level">基础信息</span>
                 </div>
                <el-row :gutter="20" class="mLeft">
                    <el-col :span="7">
                        <el-form-item label="所在省：">
                                <span>{{ruleForm.fProvinceName}}</span>
                        </el-form-item>         
                    </el-col>
                </el-row>
                <el-row :gutter="20" class="mLeft">
                    <el-col :span="7">
                        <el-form-item label="所在市：">
                            <span>{{ruleForm.fCityName}}</span>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="20" class="mLeft">
                    <el-col :span="7">
                        <el-form-item label="所在区县：">
                            <span>{{ruleForm.fAreaName}}</span>
                        </el-form-item>
                    </el-col>
                </el-row>
                <div class="footer">
                    <el-button @click="goBack">返回</el-button>
                </div>
            </div>
        </el-form>
    </div>
</template>

<script>
import Levelbar from '../layout/Levelbar';
import {viewParentInfo} from 'api/parentManagement';
import { mapGetters } from 'vuex';
export default{
    name: 'checkParentManage',
    components: {Levelbar},
    data() {
        return {
            ruleForm: {
                realName: '',
                fProvinceName: '',
                fCityName: '',
                fAreaName: '',
                studentId: '',
                enrollSituation: '',
                phone: ''
            },
            dataForm: [],
            subject: '',
            rules: {
                levelSchool: [
               
                ]

            }
        }
    },
    created() {
        this.checkViewParentInfo();
    },
    computed: {
        ...mapGetters([
            'uid',
            'schoolId'
        ]) 
    },
    methods: {
        checkViewParentInfo() {
            let schoolId=this.schoolId;
            viewParentInfo(schoolId, this.$route.params.parentId, this.$route.params.userId).then(response => {
                let infor=response.data.content;
                this.dataForm=response.data.content.studentParentRelation;
                this.ruleForm.fProvinceName = infor.provinces.provinceName?infor.provinces.provinceName:'--';
                this.ruleForm.fCityName = infor.provinces.cityName?infor.provinces.cityName:'--';
                this.ruleForm.fAreaName = infor.provinces.areaName?infor.provinces.areaName:'--';
                this.ruleForm.realName = infor.registration.name?infor.registration.name:'--';
                this.ruleForm.phone = infor.registration.phone?infor.registration.phone:'--';
                this.ruleForm.studentId = infor.registration.exueCode?infor.registration.exueCode:'--';
                this.ruleForm.enrollSituation = infor.registration.registration ? '已注册' : '未注册';
                this.ruleForm.dataForm = infor.studentParentRelation;// 家长身份
            });
        },
        // 查看按钮，跳转学生信息
        checkParentManage(studentId) {
            this.$router.push({path: `/studentManage/studentInforPage/${studentId}`})
        },
        // 跳转
        submitForm() {
            this.$router.push({path: '/studentManage/parentManage'});
        },
        goBack() {
            window.history.back();
        }
    }
}
</script>

<style lang="scss" scoped>
.app-container {
    position: relative;
    padding: 20px 20px 10px;
    .app-levelbar {
        height: 35px;
    }
    .warn-infor{
        font-size:14px;
        color:#333;
        padding-left:14px;
    }
    .el-form{
        background:#fff;
        .appTop{
            padding:40px 0 20px 0px;
            margin-bottom:10px;
            position:relative;
        }
        input{
            border:none;
        }
        .el-input{
            .el-input__inner{
             border:none !important;
            }
        }
       
        .appTop:before {
            content: '';           
            float: left;
            border-radius: 2px;
            width:4px;
            height:17px;
            background:#ff5e2c;
            margin-top:3px;
        }
        .appTop p{
            margin-left:15px;
        }
        .el-form-item{
            margin-top:8px;
        }

        .addContinue{
            margin-left:60px;
            margin-top:20px
        }
        .appTitle{
            padding-top:8px;
            text-align: center;
            font-size: 18px;
            color: #333;
            line-height: 72px;
            font-weight: bold;
            font-family: Microsoft YaHei;
            border-bottom: 1px solid #ddd;
        }
        .box{
            padding: 0px 50px 30px;
            background:#fff;
            box-shadow:0px 0px 5px 0px rgba(0, 0, 0, 0.1); 
            -webkit-box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.1);
        }
        .el-tag{
            margin-left:10px;
            background:#f9f9f9;
            color:#444;
        }
        .footer{
            text-align:center;
            margin-top:100px;
        }
        .mLeft{
            margin-left:10px !important;
        }
    }
     .form-item-title {
            margin: 40px 0;
            font-size: 14px;
            color: #333;
            line-height: 14px;
            border-left: 4px solid #ff5e2c;
            text-indent: 16px;
        }
    
}

</style>